<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<style>
.red{
    color:red;
}
</style>
<body>
    <ul>
        <li>1</li>
        <li>1</li>

    </ul>
</body>

</html>
<script>
    class JQuery {
        constructor(selector) {
            this.selector = selector;
            let elements = document.querySelectorAll(selector);
            this.length = elements.length;
            for (let i = 0; i < this.length; i++) {
                this[i] = elements[i]
            }
        }

        html() {
            return this[0].innerHTML;
        }
        addClass(cls){
            for(let i=0; i<this.length;i++){
                this[i].className = cls
            }
        }
    }
    let $ = function (selector) {
        return new JQuery(selector);
    }
    let html = $("li").html();
    let len = $("li").length;
    $("li").addClass("red")

</script>